home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / CMPLTPAS / GETEXT.PAS < prev    next >
Pascal/Delphi Source File  |  1988-09-29  |  961b  |  23 lines

  1. {->>>>GetExt<<<<-----------------------------------------------}
  2. {                                                              }
  3. { Filename : GETEXT.SRC -- Last Modified 9/29/88               }
  4. {                                                              }
  5. { Given a legal DOS file name with an extention, this routine  }
  6. { returns the extension.  If the file has no extension, it     }
  7. { returns an empty string.                                     }
  8. {                                                              }
  9. {     From: COMPLETE TURBO PASCAL 5.0  by Jeff Duntemann       }
  10. {    Scott, Foresman & Co., Inc. 1988   ISBN 0-673-38355-5     }
  11. {--------------------------------------------------------------}
  12.  
  13. FUNCTION GetExt(FileName : String80) : String80;
  14.  
  15. VAR 
  16.   DotPos : Integer;
  17.  
  18. BEGIN
  19.   DotPos := Pos('.',FileName);
  20.   IF DotPos = 0 THEN GetExt := '' ELSE
  21.     GetExt := Copy(FileName,DotPos,(Length(FileName)-DotPos)+1);
  22. END;
  23.